package com.sc.nft.admin.controller;


import com.sc.nft.admin.request.IdRequest;
import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.entity.dto.AssessLogAdminDetailsPageDTO;
import com.sc.nft.entity.dto.AssessLogAdminDetailsPageVO;
import com.sc.nft.entity.vo.WebApplicationRequirementResultVO;
import com.sc.nft.entity.vo.WebApplicationRequirementVO;
import com.sc.nft.enums.WorkCityServerAssessDetailEnum;
import com.sc.nft.service.WorkCityServerAssessDetailLogService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 考核记录详情表(WorkCityServerAssessDetailLog)表控制层
 *
 * @author 王伟成
 * @since 2024-04-09 20:11:28
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/workCityServerAssessDetailLog")
@Api(tags = "考核详情")
public class WorkCityServerAssessDetailLogController {
    /**
     * 服务对象
     */
    private final WorkCityServerAssessDetailLogService workCityServerAssessDetailLogService;


    @PostMapping(value = "/assessDetailsPage", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "考核记录详情", notes = "考核记录详情", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<AssessLogAdminDetailsPageVO> assessDetailsPage(@RequestBody AssessLogAdminDetailsPageDTO request) {
        return PageResult.success(workCityServerAssessDetailLogService.assessDetailsPage(request));
    }

    @PostMapping(value = "/assessTypeDetailsScreening", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "考核类型详情筛选", notes = "考核类型筛选", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result<Map<String, String>> assessTypeDetailsScreening() {
        return Result.success(WorkCityServerAssessDetailEnum.getAll());
    }

    @PostMapping(value = "/assessDetailsResult", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "考核详情结果", notes = "考核详情结果", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result<WebApplicationRequirementResultVO> assessDetailsResult(@Validated @RequestBody IdRequest idRequest) {
        return Result.success(workCityServerAssessDetailLogService.assessDetailsResult(idRequest.getId()));
    }
}
